{extend name='public/main' /}
{block name="content"}
<style>
    .layui-form-item{
        margin-bottom: 10px;}
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <!-- <div class="layui-card-header"></div>-->

        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" lay-filter="form" method="post" autocomplete="off">
                <div class="layui-form-item">
                    <label class="layui-form-label label-required-next">上级菜单</label>
                    <div class="layui-input-block">
                        <select name='pid' class='layui-select' lay-search>
                            {foreach $menus as $menu}
                            {eq name='menu.id' value='$vo.pid|default=0'}
                            <option selected value='{$menu.id}'>{$menu.spl|raw}{$menu.title}</option>
                            {else}
                            <option value='{$menu.id}'>{$menu.spl|raw}{$menu.title}</option>
                            {/eq}
                            {/foreach}
                        </select>
                        <p class="help-block"><b>必选</b>，请选择上级菜单或顶级菜单（目前最多支持三级菜单）</p>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">菜单名称</label>
                    <div class="layui-input-block">
                        <input name="title" value='{$vo.title|default=""}' required placeholder="请输入菜单名称" class="layui-input">
                        <p class="help-block"><b>必选</b>，请填写菜单名称（如：系统管理），建议字符不要太长，一般4-6个汉字</p>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">菜单链接</label>
                    <div class="layui-input-block">
                        <input onblur="this.value=this.value === ''?'#':this.value" name="url" required placeholder="请输入菜单链接" value="{$vo.url|default='#'}" class="layui-input">
                        <p class="help-block">
                            <b>必选</b>，请填写链接地址或选择系统节点（如：https://***.com/admin/user/index.html 或 admin/user/index）
                            <br>当填写链接地址时，以下面的“权限节点”来判断菜单自动隐藏或显示，注意未填写“权限节点”时将不会隐藏该菜单哦
                        </p>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">链接参数</label>
                    <div class="layui-input-block">
                        <input name="params" placeholder="请输入链接参数" value="{$vo.params|default=''}" class="layui-input">
                        <p class="help-block">可选，设置菜单链接的GET访问参数（如：name=1&age=3）</p>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">菜单图标</label>
                    <div class="layui-input-block">
                        <div class="layui-input-inline">
                            <input placeholder="请输入或选择图标" name="icon" value='{$vo.icon|default=""}' class="layui-input">
                        </div>
                        <span style="padding:0 12px;min-width:45px" class='layui-btn layui-btn-primary'>
                            <i style="font-size:1.2em;margin:0" class='{$vo.icon|default="layui-icon layui-icon-ios"}'></i>
                        </span>
                        <button data-icon='icon' type='button' class='layui-btn layui-btn-primary'>选择图标</button>
                        <p class="help-block">可选，设置菜单选项前置图标，目前只支持 Font Awesome 5.2.0 字体图标</p>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label label-required-next">是否菜单：</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="radio" name="type" value="1" title="菜单" lay-filter="" checked>
                        <input type="radio" name="type" value="2" title="按钮" lay-filter="" >
                    </div>
                    <label class="layui-form-label label-required-next">权限验证：</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="radio" name="auth_open" value="1" title="是" lay-filter=""  checked>
                        <input type="radio" name="auth_open" value="2" title="否" lay-filter="" >
                        <p class="help-block">是否将该菜单加入权限验证！</p>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">是否记录日志</label>
                    <div class="layui-input-block">
                        <select name='log_type' class='layui-select' lay-search>
                            <option   value='0'>不记录日志</option>
                            <option   value='1'>get</option>
                            <option   value='2'>post</option>
                            <option   value='3'>put</option>
                            <option   value='4'>delete</option>
                        </select>
                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">排序</label>
                    <div class="layui-input-block">
                        <input name="sort" placeholder="请输入排序" value="{$vo.sort|default='1000'}" class="layui-input">
                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
                <div class="layui-form-item layui-layout-admin " style="width: 100%">
                        <div class=" " style="left: 0px;text-align: center;">
                            <button class="layui-btn"  type="submit">提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>

                </div>
            </form>
        </div>
    </div>
</div>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;
        var info = {:json_encode($vo)};
        form.val("form",info);
    })
    </script>
{/block}
